Set GOOS and GOARCH environment variables before go build. Go's toolchain includes full cross-compilation support with no separate toolchain needed for pure Go code.
CGO_ENABLED=0 produces a fully static binary — required for FROM scratch Docker images
CGo complicates cross-compilation — use Docker buildx for services that require CGo
GOARM=7 for 32-bit ARM (Raspberry Pi) alongside GOARCH=arm
Version the binary with ldflags: -ldflags "-X main.version=$(git describe --tags)"
Use goreleaser for automating multi-platform releases with changelogs and checksums